{include file=member.header.html}
<script type="text/javascript">
function submitData()
{
	var orig_password = $('#orig_password').val();
	var new_password= $('#new_password').val();
	var confirm_password   = $('#confirm_password').val();
	if(orig_password == "")
	{
		errormsg('{$lang.orig_password_empty}');
	}
	else
	{
		if(new_password == "")
		{
			errormsg('{$lang.no_pass}');
		}
		else if(new_password.length < 6 || new_password.length > 20)
		{
			errormsg('{$lang.password_length_limit}');
		}
		else
		{
			if(confirm_password == "")
			{
				errormsg('{$lang.no_pass}');
			}
			else
			{
				if(confirm_password !== new_password)
				{
					errormsg('{$lang.twice_pass_not_match}');
				}
				else
				{
					var url = REAL_SITE_URL+"/index.php?app=member&act=password";
					$.post(url,{orig_password:orig_password,new_password:new_password,confirm_password:confirm_password},function(data){
							if(data === true){
								msg("{$lang.handle_ok}");
								setTimeout(function(){
										window.location.href="{url app=member}";
								},1500);
							} 
							else
							{
								errormsg(data);
							}
					},"json");	
				}
			}
		}
	}
}
</script>
<div id="page-my-password">
	<div class="page-body my-password add-address mt10">
		<ul class="padding10">
			<li><input type="password"  class="input" name="orig_password" id="orig_password"  placeholder="{$lang.orig_password}"/></li>
            <li>
                <input type="password"  class="input" placeholder="{$lang.new_password}" id="new_password" name="new_password" />
            </li>
            <li>
                <input type="password"  class="input" id="confirm_password" name="confirm_password" placeholder="{$lang.confirm_password}"/>
            </li>
            <li>
            <div class="btn-box">
            <input type="button" onclick="submitData();" value="{$lang.submit}" />
            </div>
		</ul>
	</div>
</div>
{include file=footer.html}
